<template>
  <div v-if="goodsParameters && goodsParameters.length" class="goods-detail">
    <ul class="parameters flex flex-wrap">
      <li v-for="(item, index) in goodsParameters" :key="index" class="flex v-align-t">
        <span class="font-color-9">{{item.parameterName}}：</span>
        <span class="flex-item">{{item.parameterValue}}</span>
      </li>
    </ul>
    <div class="parameters-line" />
  </div>
</template>

<script lang="ts">
  import {
    defineComponent,
    ref,
    onMounted,
    inject
  } from 'vue'
  export default defineComponent({
    name: 'GoodsParameters',
    setup() {
      let goodsParameters = inject('goodsParameters')
      onMounted(() => {})
      return {
        goodsParameters
      }
    }
  })
</script>

<style lang="scss" scoped>
  $darkBlue: #182245;
  $recommendGoodsWidth: 190px;

  .goods-detail {
    .h-title {
      border-bottom: #f2f2f2 2px solid;

      span {
        background: $darkBlue;
      }

      h2 {
        margin: 0px 0 0 0;
        padding: 0;
        font-weight: normal;
        font-size: 20px;
      }
    }

    .parameters {
      padding: 18px 0px 20px 30px;

      li {
        width: 298px;
        padding: 8px 10px 8px 0;
        box-sizing: border-box;

        &:nth-child(4n) {
          width: 226px;
        }
      }
    }

    .parameters-line {
      height: 2px;
      background: #f2f2f2;
    }

    .goods-list {
      .goods-bar {
        width: $recommendGoodsWidth;
      }

      .goods-img {
        width: $recommendGoodsWidth;
        height: 190px;
      }

      .goods-info {
        width: $recommendGoodsWidth;
        // height: 142px;
        padding: 8px 0 8px 0;
        box-sizing: border-box;
      }

      ._line-1 {
        /* line-height: 1.4; */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        word-break: break-word;
      }

      ._line-2 {
        /* line-height: 1.4; */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: break-word;
      }
    }
  }
</style>
